home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / muds / pennmush.000 / pennmush-1.50-p8-linux.tar / pennmush / db.h < prev    next >
C/C++ Source or Header  |  1993-03-24  |  3KB  |  71 lines

  1. /* db.h */
  2.  
  3. #include "copyright.h"
  4.  
  5. #ifndef __DB_H
  6. #define __DB_H
  7. #include <stdio.h>
  8.  
  9. #include "attrib.h"
  10. #include "flags.h"
  11. #include "dbdefs.h"
  12.  
  13. /* Power macros */
  14.  
  15. #define Builder(x)       ((Powers(Owner(x)) & CAN_BUILD) || \
  16.               (Powers(x) & CAN_BUILD) || \
  17.               Hasprivs(x) || Hasprivs(Owner(x)))
  18. #define Tel_Anywhere(x)  (Hasprivs(x) || (Powers(x) & TEL_ANYWHERE))
  19. #define Tel_Anything(x)  (Hasprivs(x) || (Powers(x) & TEL_OTHER))
  20. #define See_All(x)       (Hasprivs(x) || (Powers(x) & SEE_ALL))
  21. #define Priv_Who(x)      (Hasprivs(x) || (Powers(x) & SEE_ALL))
  22. #define Immortal(x)      (Powers(x) & IMMORTAL)
  23. #define Can_Hide(x)      (Hasprivs(x) || (Powers(x) & CAN_HIDE))
  24. #define Can_Login(x)     (Hasprivs(x) || (Powers(x) & LOGIN_ANYTIME))
  25. #define Can_Idle(x)      (Hasprivs(x) || (Powers(x) & UNLIMITED_IDLE))
  26. #define Long_Fingers(x)  (Hasprivs(x) || (Powers(x) & LONG_FINGERS))
  27. #define Can_Boot(x)      (Wizard(x) || (Powers(x) & CAN_BOOT))
  28. #define Do_Quotas(x)     (Wizard(x) || (Powers(x) & CHANGE_QUOTAS))
  29. #define Change_Poll(x)   (Wizard(x) || (Powers(x) & SET_POLL))
  30. #define HugeQueue(x)     (Wizard(x) || (Powers(x) & HUGE_QUEUE))
  31. #define LookQueue(x)     (Hasprivs(x) || (Powers(x) & PS_ALL))
  32. #define HaltAny(x)       (Wizard(x) || (Powers(x) & HALT_ANYTHING))
  33. #define NoPay(x)         (Hasprivs(x) || Hasprivs(Owner(x)) || Immortal(x))
  34. #define Search_All(x)    (Hasprivs(x) || (Powers(x) & SEARCH_ALL))
  35. #define Global_Funcs(x)  (Wizard(x) || (Powers(x) & GLOBAL_FUNCS))
  36. #define Create_Player(x) (Wizard(x) || (Powers(x) & CREATE_PLAYER))
  37.  
  38. /* Permission macros */
  39.  
  40. #ifdef PLAYER_LOCATE
  41. #define Can_Locate(p,x)     (controls(p,x) || nearby(p,x) || \
  42.                  ((Typeof(x) == TYPE_PLAYER) && \
  43.                   !(Flags(x) & UNFIND) && \
  44.                   !(Flags(Location(x)) & UNFIND)) || \
  45.                  See_All(p))
  46. #else
  47. #define Can_Locate(p,x)     (controls(p,x) || nearby(p,x) || See_All(p))
  48. #endif                /* PLAYER_LOCATE */
  49.  
  50. #define Can_Examine(p,x)    (controls(p,x) || See_All(p) || Visual(x))
  51. #define can_link(p,x)  (controls(p,x) || \
  52.             ((Typeof(x) == TYPE_EXIT) && (Location(x) == NOTHING)))
  53. #define can_link_to(p,x)    (GoodObject(x) && \
  54.                  (controls(p,x) || (Flags(x) & LINK_OK)))
  55.  
  56. /* can p access attribute a on object x? */
  57.  
  58. #define Can_Read_Attr(p,x,a)   \
  59.    (!((a)->flags & AF_DARK) && \
  60.     (See_All(p) || \
  61.      (!((a)->flags & AF_MDARK) && \
  62.       (controls(p,x) || !((a)->flags & AF_ODARK) || Visual(x) || \
  63.        (Owner((a)->creator) == Owner(p))))))
  64.  
  65. #define Can_Write_Attr(p,x,a)  \
  66.    (Wizard(p) || (!((a)->flags & AF_WIZARD) &&   \
  67.           (!((a)->flags & AF_LOCKED) ||  \
  68.           ((a)->creator == Owner(p)))))
  69.  
  70. #endif                /* __DB_H */
  71.